<template>
  <Demo v-if="ish"></Demo>
  <button @click="ish = !ish">显示/隐藏</button>
  <!-- 隐藏跟挂载之后就会触发beforeCreate created beforeMount mounted -->
  <!-- 隐藏的时候 就会触发beforeUnmount unmount -->
</template>

<script>
import { onBeforeMount, ref } from 'vue';
import Demo from "./components/Demo.vue";
export default {
  name: "App",
  components: { Demo },
  setup(){
    let ish=ref(true)

    //写在setup()里的写法，要先去引入 不用return出去
    //setup()就相当于beforeCreate()跟create()了 里面不能再写这两个了
    onBeforeMount(()=>{
      console.log('gg');
    })


    return{
      ish
    }
  }
};
</script>

<style>
</style>
